package com.lesama.recursion;

public class RecursionDemo1 {
    public static void main(String[] args) {
        // 计算1-100的和
        System.out.println(getSum(100));
    }
    public static int getSum(int num) {
        if(num == 1)    return 1;
        return num + getSum(num - 1);
    }
}
